package com.cb.controller.member.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;

import com.cb.common.webapp.context.RequestContext;
import com.cb.core.controller.BaseListController;
import com.cb.domain.model.system.SystemUser;
import com.cb.domain.model.user.UserAccount;
import com.cb.domain.service.system.SystemUserManager;
import com.cb.domain.service.user.UserManager;

public class MemberIndexController extends BaseListController{
	
	@Autowired
	private UserManager userManager;
	
	public ModelAndView defaultAction(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView("front/user/userRegister");
	}

	/**
	 * 查看实体对象详细信息
	 * @param request
	 * @param response
	 * @return
	 */
	public ModelAndView viewDetail(HttpServletRequest request,	HttpServletResponse response){
		UserAccount account=RequestContext.getCurrentUser();
		UserAccount user=null;
		if(account!=null){
			user=userManager.get(account.getUserId());
		}
		return new ModelAndView("member/user/userInfo","userinfo",user);
	}
	
	
	/**
	 * 跳转到密码修改页面
	 * @param request
	 * @param response
	 * @return
	 */
	public ModelAndView forwardPwd(HttpServletRequest request,	HttpServletResponse response){
		return new ModelAndView("member/user/editMember","msg","原密码错误!");
	}
}
